\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage[noend]{algpseudocode}
\begin{document}
  \begin{algorithm}
    \caption{Quadratic Line Min}
    \begin{algorithmic}[1]
      \Statex $f$: Force vector
      \Statex $h$: H
      \Statex $x$: Coordinates
      \Statex $e$: input energy
      \State{$fdoth = f \cdot h$}
      \If {$fdoth <= 0$}
        \State{$\Return DOWNHILL$}
      \EndIf
      \State{$h_{max} \gets \max(|h|)$}
      \State{$\alpha_{max} \gets \min(\alpha_{max}, \frac{d_{max}}{h_{max}})$}
      \If {$h_{max} = 0$}
        \State{$\Return FORCEZERO$}
      \EndIf
      \State{$x_0 \gets x$}
      \State{$\alpha \gets \alpha_{max}$}
      \State{$fh_0 \gets fdoth$}
      \State{$e_0 \gets e$}
      \State{$\alpha_0 \gets 0$}
      \While{$1$}
      \State{$f_1, e_1 \gets \Call{force}{x + \alpha h}$}
      \State{$ff_1 \gets f_1 \cdot f_1$}
      \State{$fh_1 \gets f_1 \cdot h_1$}
      \State{$\Delta fh \gets fh_1 - fh_0$}
      \If {$|fh_1| < EPS \lor |\Delta fh| < EPS$}
        \State{$f_1, e_1 \gets \Call{force}{x}$}
        \State{$\Return ZEROQUAD$}
      \EndIf
      \State{$rerr \gets 1.0-\frac{0.5(\alpha-\alpha_0)(fh_1+fh_0)+e_1}{e_0}$}
      \State{$\alpha_0 \gets \frac{(\alpha - \alpha_0)fh}{\Delta fh}$}
      \If {$rerr \le TOL \land \alpha_0 > 0 \land \alpha_0 < \alpha_{max}$}
        \State{$f_1, e_1 \gets \Call{force}{x + \alpha_0h}$}
        \If{$e_1 - e_0 < EMACH$}
          \State{$\Return 0$}
        \EndIf
      \EndIf
      \State{$de_{ideal} \gets -BACKTRACE\_SLOPE \alpha fh$}
      \State{$de \gets e_1 - e_0$}
      \If{$de \le de_{ideal}$}
        \State{$\Return 0$}
      \EndIf
      \State{$fh_0 \gets fh_1$}
      \State{$e_0 \gets e_1$}
      \State{$\alpha_0 \gets \alpha$}
      \State{$\alpha \gets ALPHA\_REDUCE \alpha$}
      \If{$\alpha \le 0.0 \lor de_{ideal} >= -EMACH$}
        \State{$e_1 \gets \Call{force}{x}$}
        \State{$\Return ZEROALPHA$}
      \EndIf
      \EndWhile
    \end{algorithmic}
  \end{algorithm}
  \begin{algorithm}
    \caption{CG Minimize}
    \begin{algorithmic}[1]
      \State{$e0, f \gets \Call{force}$}
      \State{$g, h\gets f$}
      \State{$gg\gets f \cdot f$}
      \For {$i \gets 0, maxiter$}
        \State{$e0 \gets e$}
        \State{$fail, \alpha \gets linemin(e)$}
        \State{$\Return fail if fail$}
        \State{check MAXEVAL}
        \State{$\Return ETOL if |e - e0| < etol \cdot \frac{|e| + |e0| + 1e-8}{2}$}
        \State{$ff \gets f \cdot f$}
        \State{$fg \gets f \cdot g$}
        % \State{$fnorm \gets ||f||$}
        \State{$\Return{FTOL} if ||f|| < ftol^2$}
        \State{$\beta \gets \max\{0, \frac{ff - fg}{gg}\}$}
        \State{$g \gets f$}
        \State{$h \gets g + \beta h$}
        \State{$gh \gets g \cdot h$}
        \If{$gh \le 0$}
          \State{$h \gets g$}
        \EndIf
      \EndFor
    \end{algorithmic}
  \end{algorithm}
\end{document}